package com.example.springcloudwinter.controller;


import com.example.springcloudwinter.dto.ResultEntity;
import com.example.springcloudwinter.service.VIPService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

@RefreshScope
@RestController
@RequestMapping("/vip")
public class VIPController {
	
	@Autowired
	private VIPService vipService;
	
	@PostMapping("/subscription")
	public ResultEntity<?> openMembershipByUserId (@RequestParam("userId") String userId) {
		return vipService.openMembershipByUserId(userId);
	}
	
	@GetMapping("/query")
	public ResultEntity<?> checkVIPByUserId  (@RequestParam ("userId") String userId) {
		return vipService.checkVIPByUserId(userId);
	}
}
